using System;
using Microsoft.Practices.ServiceLocation;

namespace MetaContainer
{
   /// <summary>
   /// A simple abstract interface over any dependency injection container.
   /// </summary>
   public interface IMetaContainer : IServiceLocator
   {
      /// <summary>
      /// Registers mapping from service interface <paramref name="from"/> to implementation class
      /// <paramref name="to"/> named <paramref name="name"/> and with <paramref name="scope"/> scope.
      /// </summary>
      /// <param name="from">Service interface type.</param>
      /// <param name="to">Service implementation type.</param>
      /// <param name="name">Name of the mapping (if named, otherwise - null).</param>
      /// <param name="scope">Scope or lifestyle of a component.</param>
      void Register(Type from, Type to, string name, Scope scope);
      /// <summary>
      /// Registers mapping from service interface <paramref name="from"/> to a method <paramref name="factoryMethod"/> producing
      /// service implementation objects. Mapping is defined with <paramref name="scope"/> scope.
      /// </summary>
      /// <param name="from">Service interface type.</param>
      /// <param name="factoryMethod">A method producing service implementations.</param>      
      /// <param name="scope">Scope or lifestyle of a component.</param>
      void Register(Type from, Func<string, object> factoryMethod, Scope scope);
      /// <summary>
      /// Creates child container for current container.
      /// </summary>
      /// <returns>A child container instance or null, if infrastructure doesn't support child
      /// container feature.</returns>
      IMetaContainer CreateChildContainer();
   }
}